<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Hardware Abstraction Layer (HAL)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="logo.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Hardware Abstraction Layer (HAL)</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__group__hal__clock.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a> &#124;
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">Clock<div class="ingroups"><a class="el" href="group__group__hal.html">HAL Drivers</a> &#124; <a class="el" href="group__group__hal__types.html">HAL General Types/Macros</a> &raquo; <a class="el" href="group__group__hal__general__types.html">General Types</a></div></div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p >Interface for getting and changing clock configuration. </p>
<p >group_hal_syspm</p>
<p >The clock driver is a single API designed to allow reading and configuring any clock in the system. The driver works the same to configure System clocks as it does for Peripheral clocks. It supports both a readonly mode where any number of items can get information about the clock. Alternatively, each clock can have a single owner that is able to adjust the configuration of the clock.</p>
<p >This driver supports source clocks, clock dividers, and clock signal muxes. All clock objects support the get() functions. Only some clocks support setting specific attributes. Use the <a class="el" href="group__group__hal__clock.html#ga8f446024e921c474e423e6667931cf64">cyhal_clock_get_features()</a> function to determine which features are settable for a specific clock. Calling a set() function on a clock that does not support it will return an error.</p>
<p >This driver makes no assumptions about how the device is currently configured. It can be used from a completely unconfigured system (eg: device just booted) to a fully pre-configured (eg: setup by the Device Configurator). The drivers query and modify the actual state of the hardware, there is no caching or remembering of state. To maximize portability of code, it is often convenient to place all system clock configuration into a Board Support Package (BSP) so the main application code is flexible and can port between devices.</p>
<p >All System Clock instances are available as constant variables in the implementation specific header. These clocks can be used directly to call any get() function. Similarly, <a class="el" href="group__group__hal__clock.html#gae94ce0d50bec8e53aa9386248f96c448">cyhal_clock_get</a> allows for getting access to a specific clock object given a resource instance. Like the constant variables, this clock reference can be used to call any of the get() functions at any time. If a clock needs to be modified, either <a class="el" href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">cyhal_clock_allocate</a> or <a class="el" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a> must be called to obtain a lock on the clock object and to ensure that nothing else in the application is currently using it or assuming its configuration is stable. If exclusive control of a clock is no longer needed <a class="el" href="group__group__hal__clock.html#gad6fc51ca095f1810acc323d8b79a4ed4">cyhal_clock_free</a> can be called to release it. This will remove the lock allowing something else in the system to potentially modify its state.</p>
<p ><a class="el" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a> and <a class="el" href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">cyhal_clock_allocate</a> are very similar. They both reserve a clock object that can then be modified. The difference between them is the argument that is passed in. <a class="el" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a> takes a specific instance that it will attempt to reserve. <a class="el" href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">cyhal_clock_allocate</a> takes in a type of clock that it will attempt to find a free instance for and reserve that.</p>
<dl class="section note"><dt>Note</dt><dd>After calling <a class="el" href="group__group__hal__clock.html#gad6fc51ca095f1810acc323d8b79a4ed4">cyhal_clock_free</a> the clock object can still be used to call any of the get() functions just as is possible from the instance returned by <a class="el" href="group__group__hal__clock.html#gae94ce0d50bec8e53aa9386248f96c448">cyhal_clock_get</a> or using any of the constant clock variables.</dd>
<dd>
A clock only needs to be allocated ( <a class="el" href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">cyhal_clock_allocate</a> ) or reserved ( <a class="el" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a> ) if its configuration needs to be changed by calling one of the set() functions.</dd>
<dd>
While the API is generic, the specific clock resource instances (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a>) are device specific. See the implementation specific sections for more details on what clocks and hardware resources are available.</dd></dl>
<h1><a class="anchor" id="section_clock_features"></a>
Features</h1>
<ul>
<li>Queryable clock features</li>
<li>Configurable clock enablement</li>
<li>Configurable clock frequency/divider</li>
<li>Configurable clock sources</li>
<li>Reserve or share clock objects</li>
</ul>
<h1><a class="anchor" id="section_clock_quickstart"></a>
Quick Start</h1>
<p >See <a class="el" href="group__group__hal__clock.html#subsection_clock_snippet_1">Snippet 1: Simple clock read only access</a> for a code snippet that shows how to reserve and configure a clock object.</p>
<h1><a class="anchor" id="section_clock_snippets"></a>
Code snippets</h1>
<dl class="section note"><dt>Note</dt><dd>Error handling code has been intentionally left out of snippets to highlight API usage.</dd></dl>
<h2><a class="anchor" id="subsection_clock_snippet_1"></a>
Snippet 1: Simple clock read only access</h2>
<p >The following snippet shows how get details about a clock if there is no need to adjust any of its settings (e.g. read only access). This does not require initializing a clock object. </p><div class="fragment"><div class="line">    uint32_t      freq;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordtype">bool</span> enabled = <a class="code hl_function" href="group__group__hal__clock.html#ga095e3002105bcd15a5b814f1abe873e8">cyhal_clock_is_enabled</a>(&amp;<a class="code hl_variable" href="group__group__hal__impl__clock.html#gafa4836792bae2914a3d2b6297c18f61d">CYHAL_CLOCK_IMO</a>);</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">if</span> (enabled)</div>
<div class="line">    {</div>
<div class="line">        freq = <a class="code hl_function" href="group__group__hal__clock.html#gab96248124df045a665fe693801f9a358">cyhal_clock_get_frequency</a>(&amp;<a class="code hl_variable" href="group__group__hal__impl__clock.html#gafa4836792bae2914a3d2b6297c18f61d">CYHAL_CLOCK_IMO</a>);</div>
<div class="line"> </div>
<div class="line">        <span class="comment">// Use frequency information for something</span></div>
<div class="line">    }</div>
<div class="ttc" id="agroup__group__hal__clock_html_ga095e3002105bcd15a5b814f1abe873e8"><div class="ttname"><a href="group__group__hal__clock.html#ga095e3002105bcd15a5b814f1abe873e8">cyhal_clock_is_enabled</a></div><div class="ttdeci">bool cyhal_clock_is_enabled(const cyhal_clock_t *clock)</div><div class="ttdoc">Gets whether the specified clock is currently enabled and locked, if appropriate.</div></div>
<div class="ttc" id="agroup__group__hal__clock_html_gab96248124df045a665fe693801f9a358"><div class="ttname"><a href="group__group__hal__clock.html#gab96248124df045a665fe693801f9a358">cyhal_clock_get_frequency</a></div><div class="ttdeci">uint32_t cyhal_clock_get_frequency(const cyhal_clock_t *clock)</div><div class="ttdoc">Gets the frequency (in Hz) the clock is currently operating at.</div></div>
<div class="ttc" id="agroup__group__hal__impl__clock_html_gafa4836792bae2914a3d2b6297c18f61d"><div class="ttname"><a href="group__group__hal__impl__clock.html#gafa4836792bae2914a3d2b6297c18f61d">CYHAL_CLOCK_IMO</a></div><div class="ttdeci">const cyhal_clock_t CYHAL_CLOCK_IMO</div><div class="ttdoc">Internal Main Oscillator: This is a fixed-frequency clock that is commonly used as a general purpose ...</div></div>
</div><!-- fragment --><h2><a class="anchor" id="subsection_clock_snippet_2"></a>
Snippet 2: Simple clock reservation and configuration</h2>
<p >The following snippet initializes a clock object, updates its frequency then enables it. </p><div class="fragment"><div class="line">    <a class="code hl_typedef" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>     rslt;</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> clock_obj;</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Reserve, take ownership of, the specified clock instance</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a>(&amp;clock_obj, &amp;<a class="code hl_variable" href="group__group__hal__impl__clock.html#gafa4836792bae2914a3d2b6297c18f61d">CYHAL_CLOCK_IMO</a>);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Set the clock frequency to 1MHz, no tolerance restriction</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__clock.html#ga144e152ee4f10bdba0dcd036e3ef879c">cyhal_clock_set_frequency</a>(&amp;clock_obj, 1000000, NULL);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// If the clock is not already enabled, enable it</span></div>
<div class="line">    <span class="keywordflow">if</span> (!<a class="code hl_function" href="group__group__hal__clock.html#ga095e3002105bcd15a5b814f1abe873e8">cyhal_clock_is_enabled</a>(&amp;clock_obj))</div>
<div class="line">    {</div>
<div class="line">        rslt = <a class="code hl_function" href="group__group__hal__clock.html#ga00a4176391fe0e66d4665dde1919079d">cyhal_clock_set_enabled</a>(&amp;clock_obj, <span class="keyword">true</span>, <span class="keyword">true</span>);</div>
<div class="line">    }</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// If no longer need to directly control the clock, it can be freed</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__clock.html#gad6fc51ca095f1810acc323d8b79a4ed4">cyhal_clock_free</a>(&amp;clock_obj);</div>
<div class="ttc" id="agroup__group__hal__clock_html_ga00a4176391fe0e66d4665dde1919079d"><div class="ttname"><a href="group__group__hal__clock.html#ga00a4176391fe0e66d4665dde1919079d">cyhal_clock_set_enabled</a></div><div class="ttdeci">cy_rslt_t cyhal_clock_set_enabled(cyhal_clock_t *clock, bool enabled, bool wait_for_lock)</div><div class="ttdoc">Attempts to update the enablement of the specified clock.</div></div>
<div class="ttc" id="agroup__group__hal__clock_html_ga144e152ee4f10bdba0dcd036e3ef879c"><div class="ttname"><a href="group__group__hal__clock.html#ga144e152ee4f10bdba0dcd036e3ef879c">cyhal_clock_set_frequency</a></div><div class="ttdeci">cy_rslt_t cyhal_clock_set_frequency(cyhal_clock_t *clock, uint32_t hz, const cyhal_clock_tolerance_t *tolerance)</div><div class="ttdoc">Attempts to update the operating frequency of the clock.</div></div>
<div class="ttc" id="agroup__group__hal__clock_html_ga6e284be927d4b576585846848a036f21"><div class="ttname"><a href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a></div><div class="ttdeci">cy_rslt_t cyhal_clock_reserve(cyhal_clock_t *clock, const cyhal_clock_t *clock_)</div><div class="ttdoc">Reserves the specified Clock instance.</div></div>
<div class="ttc" id="agroup__group__hal__clock_html_gad6fc51ca095f1810acc323d8b79a4ed4"><div class="ttname"><a href="group__group__hal__clock.html#gad6fc51ca095f1810acc323d8b79a4ed4">cyhal_clock_free</a></div><div class="ttdeci">void cyhal_clock_free(cyhal_clock_t *clock)</div><div class="ttdoc">Releases the exclusive lock the clock.</div></div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_structcyhal__clock__t"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a></div><div class="ttdoc">Clock object Application code should not rely on the specific contents of this struct.</div><div class="ttdef"><b>Definition:</b> cyhal_hw_resources.h:575</div></div>
<div class="ttc" id="agroup__group__result_html_gaca79700fcc701534ce61778a9bcf57d1"><div class="ttname"><a href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a></div><div class="ttdeci">uint32_t cy_rslt_t</div><div class="ttdoc">Provides the result of an operation as a structured bitfield.</div><div class="ttdef"><b>Definition:</b> cy_result.h:438</div></div>
</div><!-- fragment --><h2><a class="anchor" id="subsection_clock_snippet_3"></a>
Snippet 3: Clock allocation and reuse</h2>
<p >The following snippet shows how a clock can be allocated and reused for multiple peripheral instances. </p><div class="fragment"><div class="line">    <a class="code hl_typedef" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>     rslt;</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> clock_obj;</div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">cyhal_clock_allocate</a>(&amp;clock_obj, <a class="code hl_enumvalue" href="group__group__hal__impl__hw__types.html#gga1968e793be1599de10dec9e2d48f66d6ad7a5eb2a34cbaf931bf1aaab6f844689">CYHAL_CLOCK_BLOCK_PERIPHERAL_16BIT</a>);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Set the clock frequency to 1MHz, no tolerance restriction</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__clock.html#ga144e152ee4f10bdba0dcd036e3ef879c">cyhal_clock_set_frequency</a>(&amp;clock_obj, 1000000, NULL);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// If the clock is not already enabled, enable it</span></div>
<div class="line">    <span class="keywordflow">if</span> (!<a class="code hl_function" href="group__group__hal__clock.html#ga095e3002105bcd15a5b814f1abe873e8">cyhal_clock_is_enabled</a>(&amp;clock_obj))</div>
<div class="line">    {</div>
<div class="line">        rslt = <a class="code hl_function" href="group__group__hal__clock.html#ga00a4176391fe0e66d4665dde1919079d">cyhal_clock_set_enabled</a>(&amp;clock_obj, <span class="keyword">true</span>, <span class="keyword">true</span>);</div>
<div class="line">    }</div>
<div class="line"> </div>
<div class="line">    cyhal_peripheral1_t my_peripheral1;</div>
<div class="line">    cyhal_peripheral2_t my_peripheral2;</div>
<div class="line">    rslt = cyhal_peripheral1_init(&amp;my_peripheral1, &amp;clock_obj);</div>
<div class="line">    rslt = cyhal_peripheral2_init(&amp;my_peripheral2, &amp;clock_obj);</div>
<div class="line"> </div>
<div class="ttc" id="agroup__group__hal__clock_html_gaa265dd236fc90f0f90b9776e16991058"><div class="ttname"><a href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">cyhal_clock_allocate</a></div><div class="ttdeci">cy_rslt_t cyhal_clock_allocate(cyhal_clock_t *clock, cyhal_clock_block_t block)</div><div class="ttdoc">Allocates and Reserves a Clock instance, of the provided block type, for use.</div></div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_gga1968e793be1599de10dec9e2d48f66d6ad7a5eb2a34cbaf931bf1aaab6f844689"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#gga1968e793be1599de10dec9e2d48f66d6ad7a5eb2a34cbaf931bf1aaab6f844689">CYHAL_CLOCK_BLOCK_PERIPHERAL_16BIT</a></div><div class="ttdeci">@ CYHAL_CLOCK_BLOCK_PERIPHERAL_16BIT</div><div class="ttdef"><b>Definition:</b> cyhal_hw_resources.h:280</div></div>
</div><!-- fragment --><h2><a class="anchor" id="subsection_clock_snippet_4"></a>
Snippet 4: Change clock source</h2>
<p >The following snippet shows how a to change the source of a clock. </p><div class="fragment"><div class="line">    <a class="code hl_typedef" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>     rslt;</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> clock_pll, clock_hf;</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Initialize, take ownership of, the specified clock instance</span></div>
<div class="line"><span class="preprocessor">    #if defined(COMPONENT_CAT1)</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a>(&amp;clock_hf, &amp;<a class="code hl_variable" href="group__group__hal__impl__clock.html#gaf4b09205667edc47ed28e48016b568b3">CYHAL_CLOCK_HF</a>[1]);</div>
<div class="line"><span class="preprocessor">    #elif defined(COMPONENT_CAT2)</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a>(&amp;clock_hf, &amp;<a class="code hl_variable" href="group__group__hal__impl__clock.html#gaf4b09205667edc47ed28e48016b568b3">CYHAL_CLOCK_HF</a>);</div>
<div class="line"><span class="preprocessor">    #endif</span></div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Allocate a generic PLL instance</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">cyhal_clock_allocate</a>(&amp;clock_pll, <a class="code hl_enumvalue" href="group__group__hal__impl__hw__types.html#gga1968e793be1599de10dec9e2d48f66d6a72bcc11752a8d6a317f3f0d007b243b5">CYHAL_CLOCK_BLOCK_PLL</a>);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Set the clock frequency to 90.316MHz (44.1, 32-bit sample)</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__clock.html#ga144e152ee4f10bdba0dcd036e3ef879c">cyhal_clock_set_frequency</a>(&amp;clock_pll, 90316000, NULL);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// If the clock is not already enabled, enable it</span></div>
<div class="line">    <span class="keywordflow">if</span> (!<a class="code hl_function" href="group__group__hal__clock.html#ga095e3002105bcd15a5b814f1abe873e8">cyhal_clock_is_enabled</a>(&amp;clock_pll))</div>
<div class="line">    {</div>
<div class="line">        rslt = <a class="code hl_function" href="group__group__hal__clock.html#ga00a4176391fe0e66d4665dde1919079d">cyhal_clock_set_enabled</a>(&amp;clock_pll, <span class="keyword">true</span>, <span class="keyword">true</span>);</div>
<div class="line">    }</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Change the source for the High Frequency clock to be the allocated PLL</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__clock.html#gafc01eb6a064545ec9ca03444df01fe8d">cyhal_clock_set_source</a>(&amp;clock_hf, &amp;clock_pll);</div>
<div class="line"> </div>
<div class="ttc" id="agroup__group__hal__clock_html_gafc01eb6a064545ec9ca03444df01fe8d"><div class="ttname"><a href="group__group__hal__clock.html#gafc01eb6a064545ec9ca03444df01fe8d">cyhal_clock_set_source</a></div><div class="ttdeci">cy_rslt_t cyhal_clock_set_source(cyhal_clock_t *clock, const cyhal_clock_t *source)</div><div class="ttdoc">Attempts to update the source for the specified clock.</div></div>
<div class="ttc" id="agroup__group__hal__impl__clock_html_gaf4b09205667edc47ed28e48016b568b3"><div class="ttname"><a href="group__group__hal__impl__clock.html#gaf4b09205667edc47ed28e48016b568b3">CYHAL_CLOCK_HF</a></div><div class="ttdeci">const cyhal_clock_t CYHAL_CLOCK_HF[SRSS_NUM_HFROOT]</div><div class="ttdoc">High Frequency Clock: A high-frequency clock output driving specific peripherals.</div></div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_gga1968e793be1599de10dec9e2d48f66d6a72bcc11752a8d6a317f3f0d007b243b5"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#gga1968e793be1599de10dec9e2d48f66d6a72bcc11752a8d6a317f3f0d007b243b5">CYHAL_CLOCK_BLOCK_PLL</a></div><div class="ttdeci">@ CYHAL_CLOCK_BLOCK_PLL</div><div class="ttdef"><b>Definition:</b> cyhal_hw_resources.h:304</div></div>
</div><!-- fragment --><h2><a class="anchor" id="subsection_clock_snippet_5"></a>
Snippet 5: System initialization</h2>
<dl class="section note"><dt>Note</dt><dd>This example is device specific. See <a class="el" href="group__group__hal__impl__clock.html#subsection_clock_snippet_5_impl">Snippet: System initialization</a> for specific implementation. </dd></dl>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="groups" name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__hal__results__clock"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__results__clock.html">Clock HAL Results</a></td></tr>
<tr class="memdesc:group__group__hal__results__clock"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clock specific return codes. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__hal__tolerance"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__tolerance.html">Group_hal_tolerance</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:structcyhal__clock__tolerance__t"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#structcyhal__clock__tolerance__t">cyhal_clock_tolerance_t</a></td></tr>
<tr class="memdesc:structcyhal__clock__tolerance__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">Structure defining a clock tolerance.  <a href="group__group__hal__clock.html#structcyhal__clock__tolerance__t">More...</a><br /></td></tr>
<tr class="separator:structcyhal__clock__tolerance__t"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:gab182973e6691142a54b1a987358e06fd"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#gab182973e6691142a54b1a987358e06fd">cyhal_clock_feature_t</a> { <br />
&#160;&#160;<a class="el" href="group__group__hal__clock.html#ggab182973e6691142a54b1a987358e06fda030928fa166a5589b5c634f6e0a91be3">CYHAL_CLOCK_FEATURE_NONE</a> = (0)
, <br />
&#160;&#160;<a class="el" href="group__group__hal__clock.html#ggab182973e6691142a54b1a987358e06fdab8048279a16655e0bb2be26e7182c774">CYHAL_CLOCK_FEATURE_ENABLE</a> = (1 &lt;&lt; 0)
, <br />
&#160;&#160;<a class="el" href="group__group__hal__clock.html#ggab182973e6691142a54b1a987358e06fdabf6321b73f73c50bb83e1b57b237e70c">CYHAL_CLOCK_FEATURE_FREQUENCY</a> = (1 &lt;&lt; 1)
, <br />
&#160;&#160;<a class="el" href="group__group__hal__clock.html#ggab182973e6691142a54b1a987358e06fda800f620ad2c3047e7a7c45f13442f744">CYHAL_CLOCK_FEATURE_DIVIDER</a> = (1 &lt;&lt; 2)
, <br />
&#160;&#160;<a class="el" href="group__group__hal__clock.html#ggab182973e6691142a54b1a987358e06fdafb1782f713e28579c9cb967f4c6e8073">CYHAL_CLOCK_FEATURE_SOURCE</a> = (1 &lt;&lt; 4)
<br />
 }</td></tr>
<tr class="memdesc:gab182973e6691142a54b1a987358e06fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enum defining the different features each clock can support of clocks.  <a href="group__group__hal__clock.html#gab182973e6691142a54b1a987358e06fd">More...</a><br /></td></tr>
<tr class="separator:gab182973e6691142a54b1a987358e06fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafb9a1aeacf13f74784613724596a040f"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#gafb9a1aeacf13f74784613724596a040f">cyhal_clock_tolerance_unit_t</a> { <br />
&#160;&#160;<a class="el" href="group__group__hal__clock.html#ggafb9a1aeacf13f74784613724596a040fa5a0f500c0aadf1da07ac7a0bcb3682e0">CYHAL_TOLERANCE_HZ</a>
, <br />
&#160;&#160;<a class="el" href="group__group__hal__clock.html#ggafb9a1aeacf13f74784613724596a040fabc9ebdb36d6908b87b3f7dcc69ac4d5e">CYHAL_TOLERANCE_PPM</a>
, <br />
&#160;&#160;<a class="el" href="group__group__hal__clock.html#ggafb9a1aeacf13f74784613724596a040faaeb9d27160dad7a64dbc3d9c51198489">CYHAL_TOLERANCE_PERCENT</a>
<br />
 }</td></tr>
<tr class="memdesc:gafb9a1aeacf13f74784613724596a040f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enum defining the different ways of specifying the acceptable clock tolerance.  <a href="group__group__hal__clock.html#gafb9a1aeacf13f74784613724596a040f">More...</a><br /></td></tr>
<tr class="separator:gafb9a1aeacf13f74784613724596a040f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gae94ce0d50bec8e53aa9386248f96c448"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#gae94ce0d50bec8e53aa9386248f96c448">cyhal_clock_get</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock, const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a> *resource)</td></tr>
<tr class="memdesc:gae94ce0d50bec8e53aa9386248f96c448"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a Clock instance for readonly use.  <a href="group__group__hal__clock.html#gae94ce0d50bec8e53aa9386248f96c448">More...</a><br /></td></tr>
<tr class="separator:gae94ce0d50bec8e53aa9386248f96c448"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6e284be927d4b576585846848a036f21"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock, const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock_)</td></tr>
<tr class="memdesc:ga6e284be927d4b576585846848a036f21"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reserves the specified Clock instance.  <a href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">More...</a><br /></td></tr>
<tr class="separator:ga6e284be927d4b576585846848a036f21"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa265dd236fc90f0f90b9776e16991058"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">cyhal_clock_allocate</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock, <a class="el" href="group__group__hal__impl__hw__types.html#ga1968e793be1599de10dec9e2d48f66d6">cyhal_clock_block_t</a> block)</td></tr>
<tr class="memdesc:gaa265dd236fc90f0f90b9776e16991058"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates and Reserves a Clock instance, of the provided block type, for use.  <a href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">More...</a><br /></td></tr>
<tr class="separator:gaa265dd236fc90f0f90b9776e16991058"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8f446024e921c474e423e6667931cf64"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__hal__clock.html#gab182973e6691142a54b1a987358e06fd">cyhal_clock_feature_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#ga8f446024e921c474e423e6667931cf64">cyhal_clock_get_features</a> (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock)</td></tr>
<tr class="memdesc:ga8f446024e921c474e423e6667931cf64"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the features supported by the specified clock.  <a href="group__group__hal__clock.html#ga8f446024e921c474e423e6667931cf64">More...</a><br /></td></tr>
<tr class="separator:ga8f446024e921c474e423e6667931cf64"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga095e3002105bcd15a5b814f1abe873e8"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#ga095e3002105bcd15a5b814f1abe873e8">cyhal_clock_is_enabled</a> (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock)</td></tr>
<tr class="memdesc:ga095e3002105bcd15a5b814f1abe873e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets whether the specified clock is currently enabled and locked, if appropriate.  <a href="group__group__hal__clock.html#ga095e3002105bcd15a5b814f1abe873e8">More...</a><br /></td></tr>
<tr class="separator:ga095e3002105bcd15a5b814f1abe873e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga00a4176391fe0e66d4665dde1919079d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#ga00a4176391fe0e66d4665dde1919079d">cyhal_clock_set_enabled</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock, bool enabled, bool wait_for_lock)</td></tr>
<tr class="memdesc:ga00a4176391fe0e66d4665dde1919079d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Attempts to update the enablement of the specified clock.  <a href="group__group__hal__clock.html#ga00a4176391fe0e66d4665dde1919079d">More...</a><br /></td></tr>
<tr class="separator:ga00a4176391fe0e66d4665dde1919079d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab96248124df045a665fe693801f9a358"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#gab96248124df045a665fe693801f9a358">cyhal_clock_get_frequency</a> (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock)</td></tr>
<tr class="memdesc:gab96248124df045a665fe693801f9a358"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the frequency (in Hz) the clock is currently operating at.  <a href="group__group__hal__clock.html#gab96248124df045a665fe693801f9a358">More...</a><br /></td></tr>
<tr class="separator:gab96248124df045a665fe693801f9a358"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga144e152ee4f10bdba0dcd036e3ef879c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#ga144e152ee4f10bdba0dcd036e3ef879c">cyhal_clock_set_frequency</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock, uint32_t hz, const <a class="el" href="group__group__hal__clock.html#structcyhal__clock__tolerance__t">cyhal_clock_tolerance_t</a> *tolerance)</td></tr>
<tr class="memdesc:ga144e152ee4f10bdba0dcd036e3ef879c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Attempts to update the operating frequency of the clock.  <a href="group__group__hal__clock.html#ga144e152ee4f10bdba0dcd036e3ef879c">More...</a><br /></td></tr>
<tr class="separator:ga144e152ee4f10bdba0dcd036e3ef879c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6d21d11d37c8812cfafa9bf00e5a1bc7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#ga6d21d11d37c8812cfafa9bf00e5a1bc7">cyhal_clock_set_divider</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock, uint32_t divider)</td></tr>
<tr class="memdesc:ga6d21d11d37c8812cfafa9bf00e5a1bc7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Attempts to update the divider, and by extension the operating frequency, of the clock.  <a href="group__group__hal__clock.html#ga6d21d11d37c8812cfafa9bf00e5a1bc7">More...</a><br /></td></tr>
<tr class="separator:ga6d21d11d37c8812cfafa9bf00e5a1bc7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab0ddd07bc17697d91c445ede9ad2f3d6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#gab0ddd07bc17697d91c445ede9ad2f3d6">cyhal_clock_get_sources</a> (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock, const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a> **sources[], uint32_t *count)</td></tr>
<tr class="memdesc:gab0ddd07bc17697d91c445ede9ad2f3d6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the clocks that can serve as inputs to the current clock.  <a href="group__group__hal__clock.html#gab0ddd07bc17697d91c445ede9ad2f3d6">More...</a><br /></td></tr>
<tr class="separator:gab0ddd07bc17697d91c445ede9ad2f3d6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafc01eb6a064545ec9ca03444df01fe8d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#gafc01eb6a064545ec9ca03444df01fe8d">cyhal_clock_set_source</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock, const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *source)</td></tr>
<tr class="memdesc:gafc01eb6a064545ec9ca03444df01fe8d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Attempts to update the source for the specified clock.  <a href="group__group__hal__clock.html#gafc01eb6a064545ec9ca03444df01fe8d">More...</a><br /></td></tr>
<tr class="separator:gafc01eb6a064545ec9ca03444df01fe8d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad6fc51ca095f1810acc323d8b79a4ed4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__clock.html#gad6fc51ca095f1810acc323d8b79a4ed4">cyhal_clock_free</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clock)</td></tr>
<tr class="memdesc:gad6fc51ca095f1810acc323d8b79a4ed4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Releases the exclusive lock the clock.  <a href="group__group__hal__clock.html#gad6fc51ca095f1810acc323d8b79a4ed4">More...</a><br /></td></tr>
<tr class="separator:gad6fc51ca095f1810acc323d8b79a4ed4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<hr/><h2 class="groupheader">Data Structure Documentation</h2>
<a name="structcyhal__clock__tolerance__t" id="structcyhal__clock__tolerance__t"></a>
<h2 class="memtitle"><span class="permalink"><a href="#structcyhal__clock__tolerance__t">&#9670;&nbsp;</a></span>cyhal_clock_tolerance_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct cyhal_clock_tolerance_t</td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a id="a40d24ccae9f6f78e2c94d5fdbef1f355" name="a40d24ccae9f6f78e2c94d5fdbef1f355"></a><a class="el" href="group__group__hal__clock.html#gafb9a1aeacf13f74784613724596a040f">cyhal_clock_tolerance_unit_t</a></td>
<td class="fieldname">
type</td>
<td class="fielddoc">
The type of the clock tolerance value. </td></tr>
<tr><td class="fieldtype">
<a id="a616d2f8495efbc9076a57ae15a76ec24" name="a616d2f8495efbc9076a57ae15a76ec24"></a>uint32_t</td>
<td class="fieldname">
value</td>
<td class="fielddoc">
The tolerance value to use. </td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="gab182973e6691142a54b1a987358e06fd" name="gab182973e6691142a54b1a987358e06fd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab182973e6691142a54b1a987358e06fd">&#9670;&nbsp;</a></span>cyhal_clock_feature_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__group__hal__clock.html#gab182973e6691142a54b1a987358e06fd">cyhal_clock_feature_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enum defining the different features each clock can support of clocks. </p>
<p >These are bit masks. These can be used to determine which set() APIs are legal for a particular clock. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggab182973e6691142a54b1a987358e06fda030928fa166a5589b5c634f6e0a91be3" name="ggab182973e6691142a54b1a987358e06fda030928fa166a5589b5c634f6e0a91be3"></a>CYHAL_CLOCK_FEATURE_NONE&#160;</td><td class="fielddoc"><p >No features of the clock are configurable. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggab182973e6691142a54b1a987358e06fdab8048279a16655e0bb2be26e7182c774" name="ggab182973e6691142a54b1a987358e06fdab8048279a16655e0bb2be26e7182c774"></a>CYHAL_CLOCK_FEATURE_ENABLE&#160;</td><td class="fielddoc"><p >The clock can be enabled &amp; disabled <a class="el" href="group__group__hal__clock.html#ga00a4176391fe0e66d4665dde1919079d">cyhal_clock_set_enabled</a>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggab182973e6691142a54b1a987358e06fdabf6321b73f73c50bb83e1b57b237e70c" name="ggab182973e6691142a54b1a987358e06fdabf6321b73f73c50bb83e1b57b237e70c"></a>CYHAL_CLOCK_FEATURE_FREQUENCY&#160;</td><td class="fielddoc"><p >The clock frequency can be adjusted <a class="el" href="group__group__hal__clock.html#ga144e152ee4f10bdba0dcd036e3ef879c">cyhal_clock_set_frequency</a>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggab182973e6691142a54b1a987358e06fda800f620ad2c3047e7a7c45f13442f744" name="ggab182973e6691142a54b1a987358e06fda800f620ad2c3047e7a7c45f13442f744"></a>CYHAL_CLOCK_FEATURE_DIVIDER&#160;</td><td class="fielddoc"><p >The clock divider can be adjusted <a class="el" href="group__group__hal__clock.html#ga6d21d11d37c8812cfafa9bf00e5a1bc7">cyhal_clock_set_divider</a>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggab182973e6691142a54b1a987358e06fdafb1782f713e28579c9cb967f4c6e8073" name="ggab182973e6691142a54b1a987358e06fdafb1782f713e28579c9cb967f4c6e8073"></a>CYHAL_CLOCK_FEATURE_SOURCE&#160;</td><td class="fielddoc"><p >The clock source can be adjusted <a class="el" href="group__group__hal__clock.html#gafc01eb6a064545ec9ca03444df01fe8d">cyhal_clock_set_source</a>. </p>
</td></tr>
</table>

</div>
</div>
<a id="gafb9a1aeacf13f74784613724596a040f" name="gafb9a1aeacf13f74784613724596a040f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gafb9a1aeacf13f74784613724596a040f">&#9670;&nbsp;</a></span>cyhal_clock_tolerance_unit_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__group__hal__clock.html#gafb9a1aeacf13f74784613724596a040f">cyhal_clock_tolerance_unit_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enum defining the different ways of specifying the acceptable clock tolerance. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggafb9a1aeacf13f74784613724596a040fa5a0f500c0aadf1da07ac7a0bcb3682e0" name="ggafb9a1aeacf13f74784613724596a040fa5a0f500c0aadf1da07ac7a0bcb3682e0"></a>CYHAL_TOLERANCE_HZ&#160;</td><td class="fielddoc"><p >Clock tolerance specified directly in Hertz. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggafb9a1aeacf13f74784613724596a040fabc9ebdb36d6908b87b3f7dcc69ac4d5e" name="ggafb9a1aeacf13f74784613724596a040fabc9ebdb36d6908b87b3f7dcc69ac4d5e"></a>CYHAL_TOLERANCE_PPM&#160;</td><td class="fielddoc"><p >Clock tolerance specified in parts-per-million. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggafb9a1aeacf13f74784613724596a040faaeb9d27160dad7a64dbc3d9c51198489" name="ggafb9a1aeacf13f74784613724596a040faaeb9d27160dad7a64dbc3d9c51198489"></a>CYHAL_TOLERANCE_PERCENT&#160;</td><td class="fielddoc"><p >Clock tolerance specified in a percent. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="gae94ce0d50bec8e53aa9386248f96c448" name="gae94ce0d50bec8e53aa9386248f96c448"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gae94ce0d50bec8e53aa9386248f96c448">&#9670;&nbsp;</a></span>cyhal_clock_get()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_clock_get </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a> *&#160;</td>
          <td class="paramname"><em>resource</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get a Clock instance for readonly use. </p>
<p >This clock object can be used to call any of the get() functions. To call any of the set() functions, <a class="el" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a> must be called to get exclusive access to the clock object to allow it to be modified.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">clock</td><td>The clock object to store the initialized data into. The caller must allocate the memory for this object but the init function will initialize its contents. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>The clock resource instance to initialize. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the get request. This will only return an error if the provided resource instance is not a valid clock object. </dd></dl>

</div>
</div>
<a id="ga6e284be927d4b576585846848a036f21" name="ga6e284be927d4b576585846848a036f21"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6e284be927d4b576585846848a036f21">&#9670;&nbsp;</a></span>cyhal_clock_reserve()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_clock_reserve </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock_</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reserves the specified Clock instance. </p>
<p >Once the clock has been reserved the get() and set() functions can be used. If at any time the clock is no longer needed, it can be released by calling <a class="el" href="group__group__hal__clock.html#gad6fc51ca095f1810acc323d8b79a4ed4">cyhal_clock_free</a>. </p><dl class="section note"><dt>Note</dt><dd>This does not change the clock configuration or connections.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">clock</td><td>The clock object to initialize. The caller must allocate the memory for this object but the init function will initialize its contents. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">clock_</td><td>The constant clock object to reserve </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the reserve request. </dd></dl>

</div>
</div>
<a id="gaa265dd236fc90f0f90b9776e16991058" name="gaa265dd236fc90f0f90b9776e16991058"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa265dd236fc90f0f90b9776e16991058">&#9670;&nbsp;</a></span>cyhal_clock_allocate()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_clock_allocate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#ga1968e793be1599de10dec9e2d48f66d6">cyhal_clock_block_t</a>&#160;</td>
          <td class="paramname"><em>block</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocates and Reserves a Clock instance, of the provided block type, for use. </p>
<p >This should be used when needing a specific type of clock but the exact instance does not matter. This does everything that is done by <a class="el" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a>. Once the clock has been allocated the get() and set() functions can be used. If at any time the clock is no longer needed, it can be released by calling <a class="el" href="group__group__hal__clock.html#gad6fc51ca095f1810acc323d8b79a4ed4">cyhal_clock_free</a>. </p><dl class="section note"><dt>Note</dt><dd>This does not change the clock configuration or connections. </dd>
<dd>
This is generally only supported for clock blocks that have multiple instances</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">clock</td><td>The clock object to initialize. The caller must allocate the memory for this object but the init function will initialize its contents. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">block</td><td>The specific type of clock to allocate </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the allocate request. </dd></dl>

</div>
</div>
<a id="ga8f446024e921c474e423e6667931cf64" name="ga8f446024e921c474e423e6667931cf64"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8f446024e921c474e423e6667931cf64">&#9670;&nbsp;</a></span>cyhal_clock_get_features()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__hal__clock.html#gab182973e6691142a54b1a987358e06fd">cyhal_clock_feature_t</a> cyhal_clock_get_features </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets the features supported by the specified clock. </p>
<p >This can be used to determine which set() APIs are legal to be called for this clock.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">clock</td><td>The clock object to get features for. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The feature set that can be configured by this clock. Features are bit mask values. </dd></dl>

</div>
</div>
<a id="ga095e3002105bcd15a5b814f1abe873e8" name="ga095e3002105bcd15a5b814f1abe873e8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga095e3002105bcd15a5b814f1abe873e8">&#9670;&nbsp;</a></span>cyhal_clock_is_enabled()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool cyhal_clock_is_enabled </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets whether the specified clock is currently enabled and locked, if appropriate. </p>
<p >While most clocks simply have an enabled state, Crystals, PLL, and a few others may also check to make sure the clock has locked and is stable before returning true.</p>
<dl class="section note"><dt>Note</dt><dd>External clocks which cannot be enabled/disabled directly will return true if a frequency has been set for them, and false otherwise</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">clock</td><td>The clock object to check if it is enabled. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Whether the specified clock is enabled or not. </dd></dl>

</div>
</div>
<a id="ga00a4176391fe0e66d4665dde1919079d" name="ga00a4176391fe0e66d4665dde1919079d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga00a4176391fe0e66d4665dde1919079d">&#9670;&nbsp;</a></span>cyhal_clock_set_enabled()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_clock_set_enabled </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>enabled</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>wait_for_lock</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Attempts to update the enablement of the specified clock. </p>
<p >This is only legal to call if the <a class="el" href="group__group__hal__clock.html#ga8f446024e921c474e423e6667931cf64">cyhal_clock_get_features</a> API indicates support for <a class="el" href="group__group__hal__clock.html#ggab182973e6691142a54b1a987358e06fdab8048279a16655e0bb2be26e7182c774">CYHAL_CLOCK_FEATURE_ENABLE</a>.</p>
<dl class="section note"><dt>Note</dt><dd><a class="el" href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">cyhal_clock_allocate</a> or <a class="el" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a> must be called on the <b>clock</b> instance before using this function.</dd>
<dd>
If disabled, any clocks or peripherals that are using this will stop working. Make sure to switch the clock source (<a class="el" href="group__group__hal__clock.html#gafc01eb6a064545ec9ca03444df01fe8d">cyhal_clock_set_source</a>) of any downstream clocks if necessary to keep them running prior to disabling their source.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">clock</td><td>The clock object to update the enablement of. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">enabled</td><td>Whether the clock should be enabled (true) or disabled (false). </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">wait_for_lock</td><td>Whether to wait for the clock to enable &amp; lock (true), or just send the request and return (false). Most clocks behave the same either way, however Crystals, PLLs, and similar require time to lock. If false, <a class="el" href="group__group__hal__clock.html#ga095e3002105bcd15a5b814f1abe873e8">cyhal_clock_is_enabled</a> needs to be used to check that it is running before using the clock. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the requested to change the clocks enablement. </dd></dl>

</div>
</div>
<a id="gab96248124df045a665fe693801f9a358" name="gab96248124df045a665fe693801f9a358"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab96248124df045a665fe693801f9a358">&#9670;&nbsp;</a></span>cyhal_clock_get_frequency()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t cyhal_clock_get_frequency </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets the frequency (in Hz) the clock is currently operating at. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">clock</td><td>The clock object to get the frequency of. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The frequency the clock is currently running at. 0 if the clock is disabled. </dd></dl>

</div>
</div>
<a id="ga144e152ee4f10bdba0dcd036e3ef879c" name="ga144e152ee4f10bdba0dcd036e3ef879c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga144e152ee4f10bdba0dcd036e3ef879c">&#9670;&nbsp;</a></span>cyhal_clock_set_frequency()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_clock_set_frequency </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>hz</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__clock.html#structcyhal__clock__tolerance__t">cyhal_clock_tolerance_t</a> *&#160;</td>
          <td class="paramname"><em>tolerance</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Attempts to update the operating frequency of the clock. </p>
<p >This is only legal to call if the <a class="el" href="group__group__hal__clock.html#ga8f446024e921c474e423e6667931cf64">cyhal_clock_get_features</a> API indicates support for <a class="el" href="group__group__hal__clock.html#ggab182973e6691142a54b1a987358e06fdabf6321b73f73c50bb83e1b57b237e70c">CYHAL_CLOCK_FEATURE_FREQUENCY</a>.</p>
<dl class="section note"><dt>Note</dt><dd><a class="el" href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">cyhal_clock_allocate</a> or <a class="el" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a> must be called on the <b>clock</b> instance before using this function.</dd>
<dd>
Some clocks (eg: FLLs &amp; PLLs) may need to be stopped before their frequency can be changed. This function will take care of disabling &amp; re-enabling as necessary, however, this can cause a temporary glitch on anything that is running off of the clock at the time. If glitch free operation is required, change the source of any downstream clocks the application before changing the clock frequency.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">clock</td><td>The clock object to set the frequency for. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">hz</td><td>The frequency, in hertz, to set the clock to. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">tolerance</td><td>The allowed tolerance from the desired hz that is acceptable, use NULL if no tolerance check is required. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the request to set the clock frequency. </dd></dl>

</div>
</div>
<a id="ga6d21d11d37c8812cfafa9bf00e5a1bc7" name="ga6d21d11d37c8812cfafa9bf00e5a1bc7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6d21d11d37c8812cfafa9bf00e5a1bc7">&#9670;&nbsp;</a></span>cyhal_clock_set_divider()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_clock_set_divider </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>divider</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Attempts to update the divider, and by extension the operating frequency, of the clock. </p>
<p >This is only legal to call if the <a class="el" href="group__group__hal__clock.html#ga8f446024e921c474e423e6667931cf64">cyhal_clock_get_features</a> API indicates support for <a class="el" href="group__group__hal__clock.html#ggab182973e6691142a54b1a987358e06fda800f620ad2c3047e7a7c45f13442f744">CYHAL_CLOCK_FEATURE_DIVIDER</a>.</p>
<dl class="section note"><dt>Note</dt><dd><a class="el" href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">cyhal_clock_allocate</a> or <a class="el" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a> must be called on the <b>clock</b> instance before using this function.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">clock</td><td>The clock object to set the divider for. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">divider</td><td>The divider value to use. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the request to set the clock divider. </dd></dl>

</div>
</div>
<a id="gab0ddd07bc17697d91c445ede9ad2f3d6" name="gab0ddd07bc17697d91c445ede9ad2f3d6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab0ddd07bc17697d91c445ede9ad2f3d6">&#9670;&nbsp;</a></span>cyhal_clock_get_sources()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_clock_get_sources </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a> **&#160;</td>
          <td class="paramname"><em>sources</em>[], </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>count</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets the clocks that can serve as inputs to the current clock. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">clock</td><td>The clock object to get legal sources for. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">sources</td><td>The sources that are legal for the current clock. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>the array does not need to be allocated before calling this the pointer will be updated to point to an existing const array. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">count</td><td>The number of clock sources contained in the <b>sources</b> variable. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the request to get clock sources. </dd></dl>

</div>
</div>
<a id="gafc01eb6a064545ec9ca03444df01fe8d" name="gafc01eb6a064545ec9ca03444df01fe8d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gafc01eb6a064545ec9ca03444df01fe8d">&#9670;&nbsp;</a></span>cyhal_clock_set_source()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_clock_set_source </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>source</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Attempts to update the source for the specified clock. </p>
<p >This is only legal to call if the <a class="el" href="group__group__hal__clock.html#ga8f446024e921c474e423e6667931cf64">cyhal_clock_get_features</a> API indicates support for <a class="el" href="group__group__hal__clock.html#ggab182973e6691142a54b1a987358e06fdafb1782f713e28579c9cb967f4c6e8073">CYHAL_CLOCK_FEATURE_SOURCE</a>.</p>
<dl class="section note"><dt>Note</dt><dd><a class="el" href="group__group__hal__clock.html#gaa265dd236fc90f0f90b9776e16991058">cyhal_clock_allocate</a> or <a class="el" href="group__group__hal__clock.html#ga6e284be927d4b576585846848a036f21">cyhal_clock_reserve</a> must be called on the <b>clock</b> instance before using this function.</dd>
<dd>
Some clocks (eg: FLLs &amp; PLLs) may need to be stopped before their source can be changed. This function will take care of disabling &amp; re-enabling as necessary, however, this can cause a temporary glitch on anything that is running off of the clock at the time. If glitch free operation is required, change the source for any downstream clocks in the application before changing the source clock.</dd>
<dd>
No checking is done to verify that the source clock is running. This needs to be done by the caller.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">clock</td><td>The clock object to set a new source for. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">source</td><td>The source clock to update to. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the request to set the source of the clock </dd></dl>

</div>
</div>
<a id="gad6fc51ca095f1810acc323d8b79a4ed4" name="gad6fc51ca095f1810acc323d8b79a4ed4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad6fc51ca095f1810acc323d8b79a4ed4">&#9670;&nbsp;</a></span>cyhal_clock_free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_clock_free </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Releases the exclusive lock the clock. </p>
<p >This instance can no longer be used to with any set() functions. It can still be used for readonly access to Clock APIs just like is possible after calling <a class="el" href="group__group__hal__clock.html#gae94ce0d50bec8e53aa9386248f96c448">cyhal_clock_get</a>.</p>
<dl class="section note"><dt>Note</dt><dd>This does not change the behavior (e.g.: enablement) of the clock.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">clock</td><td>The clock object to free </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>Hardware Abstraction Layer (HAL)</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
